//	---------------------------------------------------------------------------
//	dark-matter-data
//	Copyright (c) 2014 dark-matter-data committers
//	---------------------------------------------------------------------------
//	This program is free software; you can redistribute it and/or modify it
//	under the terms of the GNU Lesser General Public License as published by the
//	Free Software Foundation; either version 3 of the License, or (at your
//	option) any later version.
//	This program is distributed in the hope that it will be useful, but WITHOUT
//	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//	FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
//	more details.
//	You should have received a copy of the GNU Lesser General Public License along
//	with this program; if not, see <http://www.gnu.org/licenses/lgpl.html>.
//	---------------------------------------------------------------------------
package org.dmd.gpb.server.generated.dmw;

// Generated from: org.dmd.util.codegen.ImportManager.getFormattedImports(ImportManager.java:82)
// Called from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:442)
import java.util.ArrayList;                                          // Support for MULTI attribute - (BaseDMWGenerator.java:2226)
import java.util.Iterator;                                           // Support copy of MV objects - (BaseDMWGenerator.java:2240)
import org.dmd.dmc.*;                                                // If any attributes - (BaseDMWGenerator.java:1087)
import org.dmd.dmc.definitions.DmcDefinitionIF;                      // The object is a domain specific definition - (BaseDMWGenerator.java:411)
import org.dmd.dmc.types.DefinitionName;                             // Is named by - (BaseDMWGenerator.java:1062)
import org.dmd.dms.ClassDefinition;                                  // Passing derived class def up the hierarchy - (BaseDMWGenerator.java:1067)
import org.dmd.dms.Concinnity;                                       // Is reference type - (BaseDMWGenerator.java:1107)
import org.dmd.dms.generated.dmo.MetaDMSAG;                          // Attribute skip from the meta schema - (BaseDMWGenerator.java:897)
import org.dmd.dms.generated.dmw.StringIterableDMW;                  // For multi-valued String - (BaseDMWGenerator.java:2103)
import org.dmd.dms.generated.types.ConcinnityREF;                    // Is reference type REF - (BaseDMWGenerator.java:1115)
import org.dmd.gpb.server.extended.GpbCompositeType;                 // Required for getModificationRecorder() - (BaseDMWGenerator.java:1076)
import org.dmd.gpb.server.extended.GpbType;                          // Derived class - (BaseDMWGenerator.java:1248)
import org.dmd.gpb.shared.generated.dmo.GpbCompositeTypeDMO;         // Abstract class - (BaseDMWGenerator.java:1230)



/**
 * The GpbCompositeType provides a common base for enumerations and
 * messages\n so that they can be referred to as a separate type of object
 * that can be specified in\n standalone blocks within a generated
 * GpbProtoFile.
 * <P>
 * Generated from the dmdgpb schema at version 0.1
 * <P>
 * This code was auto-generated by the dmggenerator utility and shouldn't be alterred manually!
 * Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:479)
 */
abstract public class GpbCompositeTypeDMW extends GpbType implements DmcDefinitionIF, DmcNamedObjectIF {

    protected GpbCompositeTypeDMW() {
        super();
    }

    abstract public GpbCompositeType getModificationRecorder();

    public GpbCompositeTypeDMO getDMO() {
        return((GpbCompositeTypeDMO) core);
    }

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:642)
    protected GpbCompositeTypeDMW(GpbCompositeTypeDMO obj, ClassDefinition cd) {
        super(obj,cd);
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.getAccessFunctions(BaseDMWGenerator.java:1297)
    public DefinitionName getObjectName(){
        return(((GpbCompositeTypeDMO) core).getName());
    }

    public int hashCode(){
        return(getObjectName().hashCode());
    }

    public DmcAttribute<?> getObjectNameAttribute(){
        return(((GpbCompositeTypeDMO) core).getObjectNameAttribute());
    }

    public boolean equals(Object obj){
        if (obj instanceof GpbCompositeTypeDMW){
            return( getObjectName().equals( ((GpbCompositeTypeDMW) obj).getObjectName()) );
        }
        return(false);
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1474)
    public String getGenerateAs(){
        return(((GpbCompositeTypeDMO) core).getGenerateAs());
    }

    /**
     * Sets generateAs to the specified value.
     * @param value A value compatible with DmcTypeString
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1584)
    public void setGenerateAs(Object value) throws DmcValueException {
        ((GpbCompositeTypeDMO) core).setGenerateAs(value);
    }

    /**
     * Sets generateAs to the specified value.
     * @param value String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1593)
    public void setGenerateAs(String value){
        ((GpbCompositeTypeDMO) core).setGenerateAs(value);
    }

    /**
     * Removes the generateAs attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remGenerateAs(){
        ((GpbCompositeTypeDMO) core).remGenerateAs();
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1474)
    public DefinitionName getName(){
        return(((GpbCompositeTypeDMO) core).getName());
    }

    /**
     * Sets name to the specified value.
     * @param value A value compatible with DmcTypeDefinitionName
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1584)
    public void setName(Object value) throws DmcValueException {
        ((GpbCompositeTypeDMO) core).setName(value);
    }

    /**
     * Sets name to the specified value.
     * @param value DefinitionName
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1593)
    public void setName(DefinitionName value){
        ((GpbCompositeTypeDMO) core).setName(value);
    }

    /**
     * Removes the name attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remName(){
        ((GpbCompositeTypeDMO) core).remName();
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1474)
    public String getObsolete(){
        return(((GpbCompositeTypeDMO) core).getObsolete());
    }

    /**
     * Sets obsolete to the specified value.
     * @param value A value compatible with DmcTypeString
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1584)
    public void setObsolete(Object value) throws DmcValueException {
        ((GpbCompositeTypeDMO) core).setObsolete(value);
    }

    /**
     * Sets obsolete to the specified value.
     * @param value String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1593)
    public void setObsolete(String value){
        ((GpbCompositeTypeDMO) core).setObsolete(value);
    }

    /**
     * Removes the obsolete attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remObsolete(){
        ((GpbCompositeTypeDMO) core).remObsolete();
    }

    /**
     * @return The number of String items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1671)
    public int getSkipSize(){
        return(((GpbCompositeTypeDMO) core).getSkipSize());
    }

    /**
     * @return true if there are no StringDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1679)
    public boolean getSkipIsEmpty(){
        if (((GpbCompositeTypeDMO) core).getSkipSize() == 0)
            return(true);
        return(false);
    }

    /**
     * @return true if there are any StringDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1689)
    public boolean getSkipHasValue(){
        if (((GpbCompositeTypeDMO) core).getSkipSize() == 0)
            return(false);
        return(true);
    }

    /**
     * @return An Iterator of String objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2107)
    public StringIterableDMW getSkipIterable(){
        DmcAttribute<?> attr = core.get(MetaDMSAG.__skip);
        if (attr == null)
            return(StringIterableDMW.emptyList);
        
        return(new StringIterableDMW(((GpbCompositeTypeDMO) core).getSkip()));
    }

    /**
     * Adds another skip value.
     * @param value A value compatible with String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2133)
    public void addSkip(Object value) throws DmcValueException {
        ((GpbCompositeTypeDMO) core).addSkip(value);
    }

    /**
     * Adds another skip value.
     * @param value A value compatible with String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2143)
    public void addSkip(String value){
        ((GpbCompositeTypeDMO) core).addSkip(value);
    }

    /**
     * Returns true if the collection contains the skip value.
     * @param value A value compatible with String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2200)
    public boolean skipContains(String value){
        return(((GpbCompositeTypeDMO) core).skipContains(value));
    }

    /**
     * @return A COPY of the collection of String objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2244)
    @SuppressWarnings("unchecked")
    public ArrayList<String> getSkipCopy(){
        DmcAttribute<?> attr = core.get(MetaDMSAG.__skip);
        if (attr == null)
            return(new ArrayList<String>());
        
        ArrayList<String> rc = new ArrayList<String>(attr.getMVSize());
        
        Iterator<String> it = (Iterator<String>) attr.getMV();
        while(it.hasNext()){
            rc.add(it.next());
        }
        
        return(rc);
    }

    /**
     * Deletes a skip value.
     * @param value The String to be deleted from set of attribute values.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2271)
    public void delSkip(Object value) throws DmcValueException {
        ((GpbCompositeTypeDMO) core).delSkip(value);
    }

    /**
     * Deletes a skip value.
     * @param value The String to be deleted from set of attribute values.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2280)
    public void delSkip(String value){
        ((GpbCompositeTypeDMO) core).delSkip(value);
    }

    /**
     * Removes the skip attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2292)
    public void remSkip(){
        ((GpbCompositeTypeDMO) core).remSkip();
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1474)
    public String getVersion(){
        return(((GpbCompositeTypeDMO) core).getVersion());
    }

    /**
     * Sets version to the specified value.
     * @param value A value compatible with DmcTypeString
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1584)
    public void setVersion(Object value) throws DmcValueException {
        ((GpbCompositeTypeDMO) core).setVersion(value);
    }

    /**
     * Sets version to the specified value.
     * @param value String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1593)
    public void setVersion(String value){
        ((GpbCompositeTypeDMO) core).setVersion(value);
    }

    /**
     * Removes the version attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remVersion(){
        ((GpbCompositeTypeDMO) core).remVersion();
    }

    /**
     * @return A Concinnity object.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1434)
    public Concinnity getWhy(){
        ConcinnityREF ref = ((GpbCompositeTypeDMO) core).getWhy();
        if (ref == null)
            return(null);
        
        if (ref.getObject() == null)
            return(null);
        
        return((Concinnity)ref.getObject().getContainer());
    }

    /**
     * Sets the why to the specified value.
     * @param value A value compatible with ConcinnityREF
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1519)
    public void setWhy(Concinnity value) {
        ((GpbCompositeTypeDMO) core).setWhy(value.getDMO());
    }

    /**
     * Sets the why to the specified value.
     * @param value A value compatible with ConcinnityREF
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1528)
    public void setWhy(Object value) throws DmcValueException {
        ((GpbCompositeTypeDMO) core).setWhy(value);
    }

    /**
     * Removes the why attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remWhy(){
        ((GpbCompositeTypeDMO) core).remWhy();
    }


}
